package modelLayer;

import java.util.ArrayList;


public class Employee extends Person {
	private double salary;
	private ArrayList<SaleLinesItem> itemsSold;
	private double moneyEarned;
	

	public Employee(String Id, String name, String address, String phoneNumber,
		double salary, double moneyEarned) {
		super(Id, name, address, phoneNumber);
		this.salary = salary;
		itemsSold = new ArrayList<SaleLinesItem>();
		this.moneyEarned = moneyEarned;
		
}	
	

	public void setItemsSold(ArrayList<SaleLinesItem> itemsSold) {
		this.itemsSold = itemsSold;
	}


	@Override
public String toString() {
	return "Employee "+super.toString()+"[salary=" + salary + ", itemsSold=" + itemsSold
			+ ", moneyEarned=" + this.moneyEarned +"]";
}
	public String save(){
		String emp = "";
		for(Employee e1: EmployeeRecords.getInstance().getEmployees()){
			emp = emp + "," + e1.getId();
		}
		return 2+","+ super.getId()+","+super.getName()+","+super.getAddress()+","+super.getPhoneNumber()+","+moneyEarned+","+salary+","+emp;
	}

	public double getSalary() {
	return salary;
}

public void setSalary(double salary) {
	this.salary = salary;
}

public double getMoneyEarned() {
	return moneyEarned;
}

public void setMoneyEarned(double moneyEarned) {
	this.moneyEarned = moneyEarned;
}

public ArrayList<SaleLinesItem> getItemsSold() {
	return itemsSold;
}

public void addItemSold(SaleLinesItem item) {
	itemsSold.add(item);
}

}
